<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>

  <script>

    function setText(){
      text = document.getElementById("text1")
      text.value = "aaa"
    }
  </script>

  <input id="text1" type="text"/>
  <input type="button" value="改文字" onclick="setText()"/>
  
</body>
</html>